package com.fable.sp.core.domain;

import org.springframework.util.StringUtils;

import java.io.Serializable;

/**
 * .
 *
 * @author stormning on 16/8/1.
 */
public class Font implements Serializable {

    private String color;

    private Integer size;

    private String weight;

    private String family;

    private FontStyle style;

    public Integer getSize() {
        return size;
    }

    public void setSize(Integer size) {
        this.size = size;
    }

    public String getWeight() {
        return weight;
    }

    public void setWeight(String weight) {
        this.weight = weight;
    }

    public String getFamily() {
        return family;
    }

    public void setFamily(String family) {
        this.family = family;
    }

    public FontStyle getStyle() {
        return style;
    }

    public void setStyle(FontStyle style) {
        this.style = style;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    @Override
    public String toString() {
        StringBuilder style = new StringBuilder("font:");
        Integer size = getSize();
        if (size != null) {
            style.append(size).append("px");
        }
        FontStyle fs = getStyle();
        if (fs != null) {
            style.append(" ").append(fs.toString());
        }
        String weight = getWeight();
        if (StringUtils.hasText(weight)) {
            style.append(" ").append(weight);
        }
        String family = getFamily();
        if (StringUtils.hasText(family)) {
            style.append(" ").append(family);
        }
        String color = getColor();
        if (StringUtils.hasText(color)) {
            style.append(" ").append(color);
        }
        style.append(";");
        return style.toString();
    }
}
